<template>
  <div>
    <zu>
      <nava></nava>
      <div class="v_main">
        <div class="v_min">
          <div class="cc_in">
            <h2>注&nbsp;册</h2>
            <div class="sj">手机号</div>
            <el-select v-model="value" filterable placeholder="+86" class="xl" style="outline.none">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.tel"
                :value="item.value"
              >
                <span style="float: left" class="dd">{{ item.label }}</span>
              </el-option>
            </el-select>
            <el-input v-model="input1" maxlength="11" class="sr">
              <!-- <el-button :plain="true" @click="open2">警告</el-button> -->
            </el-input>
            <div class="dx">短信验证码</div>
            <!-- <div class="">
              <input type="text" class="yz" maxlength="6">
            </div>-->

            <el-form-item prop="phoneCode" class="pr">
              <el-input placeholder="请输入您接收的短信验证码" maxlength="6" v-model="input2" class="yz"></el-input>
              <button @click.prevent="getCode()" class="code-btn" :disabled="!show">
                <span v-show="show" class="sp">获取验证码</span>
                <span v-show="!show" class="count">{{ count }}s</span>
              </button>
            </el-form-item>
            <div class="mm">设置密码</div>
            <el-input placeholder="请输入密码" v-model="form.phoneCode" show-password class="dm"></el-input>
            <input class="cc" type="checkbox" name="btn" id="btn1" />
            <label for="btn1"></label>
            <span class="ss">
              已阅读并接受
              <a href="https://www.poco.cn/custom/terms" target="_blank">《POCO注册协议》</a>
            </span>
            <div class="c_btn">
              <button class="zc">注&nbsp;&nbsp;册</button>
            </div>
            <div class="c_nt">
              <a href="http://localhost:8080/#/Login" class="zh">已有账号？去登录</a>
            </div>
          </div>
        </div>
      </div>
    </zu>
  </div>
</template>
<script>
import { defineComponent, ref } from "vue";
import zu from "@/components/zu.vue";
import nava from "../../components/nava.vue";
export default {
  components: {
    // setup() {},
    zu,
    nava
  },
  data() {
    return {
      show: "false",
      count: "",
      //   open2() {
      //     ElMessage.warning({
      //       message: "警告哦，这是一条警告消息",
      //       type: "warning",
      //     });
      //   },
      input1: ref(""),
      input2: ref(""),
      //下拉框选择地区区号
      options: [
        {
          value: "1",
          label: "中国",
          tel: "+86"
        },
        {
          value: "2",
          label: "美国",
          tel: "+1"
        },
        {
          value: "3",
          label: "俄罗斯",
          tel: "+7"
        },
        {
          value: "4",
          label: "埃及",
          tel: "+20"
        },
        {
          value: "5",
          label: "荷兰",
          tel: "+31"
        },
        {
          value: "6",
          label: "法国",
          tel: "+33"
        },
        {
          value: "7",
          label: "意大利",
          tel: "+39"
        },
        {
          value: "8",
          label: "英国",
          tel: "+44"
        },
        {
          value: "9",
          label: "挪威",
          tel: "+47"
        },
        {
          value: "10",
          label: "墨西哥",
          tel: "+52"
        }
      ],
      value: "",
      //倒计时
      form: {
        phoneCode: ""
      }
    };
  },
  methods: {
    // 获取短信验证码
    getCode() {
      //axios请求
      console.log(this.form.phone);
      // 验证码倒计时
      if (!this.timer) {
        this.count = 60;
        this.show = false;
        this.timer = setInterval(() => {
          if (this.count > 0 && this.count <= 60) {
            this.count--;
          } else {
            this.show = true;
            clearInterval(this.timer);
            this.timer = null;
          }
        }, 1000);
      }
    }
  }
};
</script>
<style lang='less' scoped>
.dd {
  display: inline-block;
  vertical-align: top;

  margin-left: 10px;
  color: #999;
}
.c_nt {
  margin-top: 20px;
  margin-left: 172px;
}
.zh {
  color: #999;
  display: block;
  font-size: 16px;
  text-decoration: none;
}
.c_btn {
  margin-top: 15px;
}
.zc {
  background: #46d233;
  color: #fff;
  border: 0;
  height: 40px;
  font-size: 18px;
  width: 380px;
  margin-top: 20px;
  margin-left: -29px;
  cursor: pointer;
}
.ss {
  display: inline-block;
  vertical-align: top;
  margin-top: 23px;
  margin-left: 10px;
  color: #999;
  a {
    color: #46d233;
  }
}
.cc {
  width: 20px;
  height: 20px;
  display: inline-block;
  margin-left: -69px;
  vertical-align: middle;
  line-height: 18px;
  position: relative;
  margin-top: 20px;
}
.cc::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  background: #fff;
  width: 100%;
  height: 100%;
  border: 1px solid #42e502;
}
.cc:checked::before {
  content: "\2713";
  background-color: #fff;
  position: absolute;
  top: 01;
  left: 0;
  width: 100%;
  color: #02e561;
  font-size: 20px;
  font-weight: bold;
}

.pr {
  position: relative;
}
.sp {
  margin-top: -7px;
  color: #02e561;
}
.count {
  margin-top: -1px;
  color: #02e561;
}
.code-btn {
  width: 100px;
  height: 20px;
  position: absolute;
  top: 20px;
  right: 10px;
  z-index: 222;
  //#ef8466橘色
  color: #46d26e;
  font-size: 15px;
  border: none;
  border-left: 2px solid #e5e5e5;
  padding-left: 10px;
  background-color: #fff;
  //鼠标指针的样式:伸出食指的手,default 箭头，crosshair 十字，progress 箭头和沙漏
  cursor: pointer;
}
.dm {
  border-radius: 5px;
  width: 380px;
  height: 37px;
  margin-top: 10px;
  margin-left: -30px;
}
.mm {
  font-size: 19px;
  color: #111;
  margin-top: 25px;
  margin-left: -278px;
}
.yz {
  border-radius: 5px;
  width: 380px;
  height: 37px;
  margin-top: 10px;
  margin-left: -30px;
}
.dx {
  font-size: 19px;
  color: #111;
  margin-top: 25px;
  margin-left: -258px;
}
h2 {
  margin-left: 120px;
  margin-top: -10px;
  font-size: 26px;
  color: #111;
  font-weight: 500;
  z-index: 100;
  position: absolute;
}
.sj {
  font-size: 19px;
  color: #111;
  margin-top: 60px;
  margin-left: -300px;
}
.xl {
  width: 100px;
  height: 50px;
  margin-top: 15px;
  margin-left: -655px;
  color: #000;
}
.sr {
  width: 260px;
  height: 50px;
  margin-top: 15px;
  margin-left: 90px;
  float: left;
}
.v_main {
  background: #fff;
  position: absolute;
  z-index: 2;
  width: 480px;
  height: 560px;
  left: 640px;
  top: 120px;
}
.v_min {
  background: #fff;
  line-height: 1;
  height: 150px;
}
.cc_in {
  width: 300px;
  margin: 0 auto;
  padding: 40px 0;
  box-sizing: border-box;
}
</style>